<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.4.1.0.css">
<script src="js/jquery-3.5.0.js"></script>
<script src="js/popper.12.5.min.js"></script>
<script src="js/bootstrap.4.1.0.min.js"></script>
<script src="layer/layer.js"></script>
<script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script>
<script src="https://cdn.staticfile.org/axios/0.18.0/axios.min.js"></script>
</head>
<body>
	<div id="app" class="container">
		<input type="text" v-model="uname"><br> <input
			type="text" v-model="pwd"><br> <font color="red"><label>{{message}}</label></font><br>
		<button v-on:click="login()" class="btn">登录</button>
	</div>
	<script type="text/javascript">
        var app = new Vue({
            el:"#app",
            data:{
                uname:"",
                pwd:"",
                message:""
            },
            methods:{
            	login:function(){
            		 axios.post(
                  	   "user/login",
                  	   {"uname":this.uname,"pwd":this.pwd}
                     ).then(res => {
                  	   console.log(res);
                  	   if(res.data.code==1){
                  		   location.href="welcome.html";
                  	   }else{
                  		 layer.msg(res.data.msg); 
                  	   }
                     });
            	}
            }
        })
    </script>
</body>
</html>